package regexExercise;

public class matches {
    public static void main(String[] args) {
        String email = "i546@cafs.cac";
        String regex = "[a-zA-Z0-9_]+@[a-zA-Z]+(\\.[a-zA-Z0-9]+)+";

        boolean match = email.matches(regex);
        if(match){
            System.out.println("正确");
        }else {
            System.out.println("错误");
        }

        String email1 = "asfe4f5@dasf.sad.dsa.vs";
        String regex1 = "[a-zA-Z0-9_]+@[a-zA-Z]+(\\.[a-zA-Z0-9]+)+";

        boolean match1 = email1.matches(regex1);
        if (match1){
            System.out.println("正确");
        }else{
            System.out.println("错误");
        }
    }
}
